package com.handsome.utils;

import com.handsome.dto.BootstrapDataTableDto;
import com.handsome.entity.HsWidget;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

public class PageUtil {

   /* public static BootstrapDataTableDto startPage(Object cl){
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        int offset = Integer.parseInt(request.getParameter("offset"));
        int limit = Integer.parseInt(request.getParameter("limit"));
        String search = request.getParameter("search");
        BootstrapDataTableDto<HsWidget> tableDto = new BootstrapDataTableDto<>();


        int count = 0;
        try {
            count = hsWidgetMapper.selectCount(cl.getClass().newInstance());
        } catch (InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
        tableDto.setTotal(count);
        return tableDto;
    }*/
}
